package com.stylefeng.guns.rest.domain;

import java.util.List;

public class Page<T> {
	private int pageNum = 1; // 当前页
    private int pageSize = 16; // 每页多少行数据
    private int pages; // 共多少行
    /*private int start = 0;// 当前页起始行
    private int end;// 结束行*/
    private long total = 1; // 共多少页
    private List<T> list;//分页数据

	public List<T> getList() {
		return list;
	}

	public void setList(List<T> list) {
		this.list = list;
	}

	public int getPageNum() {
		return pageNum;
	}
	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
//		this.start = (pageNum-1)*pageSize;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
//		this.start = (pageNum-1)*pageSize;
	}

	public int getPages() {
		return pages;
	}

	public void setPages(int pages) {
		this.pages = pages;
	}

	public long getTotal() {
		return total;
	}

	public void setTotal(long total) {
		if (total>0) {
			this.total = total;
		}
	}

//	public int getStart() {
//		return start;
//	}
//	public void setStart(int start) {
//		this.start = start;
//	}
//	public int getEnd() {
//		return end;
//	}
//	public void setEnd(int end) {
//		this.end = end;
//	}

	public Page data(List list) {
		setList(list);
		if (list instanceof Page) {
			Page page = (Page) list;
			setTotal(page.getTotal());
			setPages(page.getPages());
			setPageNum(page.getPageNum());
			setPageSize(page.getPageSize());
		}
		return this;
	}
    
    
}
